﻿<%@ Page Title="" Language="C#" MasterPageFile="~/FilesPage/FileIndex.master" AutoEventWireup="true"
    CodeFile="FileManage.aspx.cs" Inherits="FilesPage_FileManage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <link href="../CSS/Files.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        function UploadComplete(sender, args) {
            var lable = document.getElementById("<%=LabelFileUploadManage.ClientID %>")
            lable.innerText = "文件：" + args.get_fileName() + "  上传成功。大小：" + args.get_length() / 1024 + " KB";
            var filename = document.getElementById("<%=TextBoxFileName.ClientID %>")
            filename.innerText = args.get_fileName();
            var savebtn = document.getElementById("<%=ImageButtonSave.ClientID %>")
            savebtn.style.display = "";
        }
        function UploadStart(sender, args) {
            var lable = document.getElementById("<%=LabelFileUploadManage.ClientID %>")
            lable.innerText = "正在上传: " + args.get_fileName();
        }
        function UploadError(sender, args) {
            var lable = document.getElementById("<%=LabelFileUploadManage.ClientID %>")
            lable.innerText = "上传文件：" + args.get_fileName() + " 失败。文件大小不能超过4MB。详细原因：" + args.get_errorMessage();
            var filename = document.getElementById("<%=TextBoxFileName.ClientID %>")
            filename.innerText = "";
            var savebtn = document.getElementById("<%=ImageButtonSave.ClientID %>")
            savebtn.style.display = "none";
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolderSon" runat="Server">
    <div id="FileManage">
        <div id="FileManageTop">
            <div id="title_filemanage">
            </div>
            <table id="fileManageTable">
                <tr>
                    <td class="td_filemanage">
                        文件名：
                    </td>
                    <td colspan="3">
                        <asp:TextBox ID="TextBoxFileName" runat="server" CssClass="textbox_filemanage" Width="200px"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBoxFileName"
                            Display="Dynamic" ErrorMessage="不能为空，请上传文件！！" ForeColor="Red"></asp:RequiredFieldValidator>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="TextBoxFileName"
                            Display="Dynamic" ErrorMessage="名字不符合规则" ForeColor="Red" 
                            ValidationExpression="(?!((^(con)$)|^(con)/..*|(^(prn)$)|^(prn)/..*|(^(aux)$)|^(aux)/..*|(^(nul)$)|^(nul)/..*|(^(com)[1-9]$)|^(com)[1-9]/..*|(^(lpt)[1-9]$)|^(lpt)[1-9]/..*)|^/s+|.*/s$)(^[^/////:/*/?/&quot;/&lt;/&gt;/\\/|/\.]{1,255}$)"></asp:RegularExpressionValidator>
                    </td>
                </tr>
                <tr>
                    <td>
                        位置：
                    </td>
                    <td colspan="3" style="font-size: 13px;">
                        <asp:TextBox ID="TextBoxPosition" runat="server" CssClass="textbox_filemanage" Enabled="False"
                            Width="200px" Font-Size="15px">\文档管理</asp:TextBox>
                        &nbsp; 在左侧选择路径
                    </td>
                </tr>
                <tr>
                    <td>
                        备注：
                    </td>
                    <td colspan="3">
                        <asp:TextBox ID="TextBoxNote" runat="server" CssClass="textbox_filemanage" Height="40px"
                            Rows="3"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        创建时间：
                    </td>
                    <td>
                        <asp:Label ID="LabelDateTime" runat="server" Width="200px"></asp:Label>
                    </td>
                    <td class="td_filemanage" style="text-align: right;">
                        所有者：
                    </td>
                    <td>
                        <asp:Label ID="LabelUserName" runat="server" Text="Label" Width="100px"></asp:Label>
                    </td>
                </tr>
            </table>
            <hr />
        </div>
        <div id="selectImage">
            <table>
                <tr>
                    <td class="td_filemanage">
                        文件图标>>
                    </td>
                    <td>
                        <asp:RadioButtonList ID="RadioButtonListImage" runat="server" Width="400px" RepeatDirection="Horizontal">
                        </asp:RadioButtonList>
                    </td>
                </tr>
            </table>
            <hr />
        </div>
        <div id="FileUpLoad" runat="server">
            <ul class="ul_filemanage">
                <li>
                    <asp:GridView ID="GridViewFiles" runat="server" CellPadding="4" ForeColor="#333333"
                        GridLines="None" Width="560px" Style="margin-right: 1px" AutoGenerateColumns="False">
                        <Columns>
                            <asp:TemplateField>
                                <ItemTemplate>
                                    <img alt="" src='<%#Eval("DocTypeImage") %>' />
                                </ItemTemplate>
                                <HeaderStyle Width="16px" />
                                <ItemStyle Width="16px" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="文件名">
                                <ItemTemplate>
                                    <asp:Label ID="FileName" runat="server"><%#Eval("DocId")%></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="创建时间">
                                <ItemTemplate>
                                    <asp:Label ID="DocCreatDate" runat="server"><%#Eval("DocCreatDate","{0:D}")%></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="位置">
                                <ItemTemplate>
                                    <asp:Label ID="filePath" runat="server" Text='<%#Eval("DocPath")%>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="上传人">
                                <ItemTemplate>
                                    <asp:Label ID="UserId" runat="server"><%#Eval("UserId")%></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="删除">
                                <ItemTemplate>
                                    <asp:ImageButton ID="deleted" runat="server" ImageUrl="~/Images/file/delete.gif"
                                        Style="height: 13px" OnClick="deleted_Click" />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="DocID" Visible="False">
                                <ItemTemplate>
                                    <asp:Label ID="DocId" runat="server" Text='<%#Eval("DocNo")%>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Doctype" Visible="False">
                                <ItemTemplate>
                                    <asp:Label ID="DocType" runat="server" Text='<%#Eval("DocTypeNo")%>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                        <AlternatingRowStyle BackColor="White" />
                        <EditRowStyle BackColor="#2461BF" />
                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                        <RowStyle BackColor="#EFF3FB" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <SortedAscendingCellStyle BackColor="#F5F7FB" />
                        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                        <SortedDescendingCellStyle BackColor="#E9EBEF" />
                        <SortedDescendingHeaderStyle BackColor="#4870BE" />
                    </asp:GridView>
                </li>
                <li class="AsyncFileUpload_filemanage">
                    <asp:AsyncFileUpload ID="AsyncFileUploadFiles" runat="server" Height="25px" Width="500px"
                        OnClientUploadComplete="UploadComplete" OnClientUploadStarted="UploadStart" OnClientUploadError="UploadError"
                        OnUploadedComplete="AsyncFileUploadFiles_UploadedComplete" UploaderStyle="Modern" />
                </li>
                <li style="text-align: right; line-height: 20px;">
                    <asp:Label ID="LabelFileUploadManage" runat="server" Text="" ForeColor="Red"></asp:Label></li>
            </ul>
            <hr />
        </div>
        <div id="bottom" style="text-align: center">
            <asp:ImageButton ID="ImageButtonSave" runat="server" CssClass="imageBtn_filemanage"
                ImageUrl="~/Images/file/saveexi.gif" OnClick="ImageButtonSave_Click" />
            <asp:ImageButton ID="ImageButtonExit" runat="server" CssClass="imageBtn_filemanage"
                ImageUrl="~/Images/file/sexit.gif" CausesValidation="False" OnClick="ImageButtonExit_Click" />
        </div>
    </div>
</asp:Content>
